/**
 * @TimerFactory.as
 * 
 * @author sodaChen mail:sujun10#21cn.com
 * @version 1.0
 * <br>Copyright (C), 2013 asFrame.com
 * <br>This program is protected by copyright laws.
 * <br>Program Name:ASFrame
 * <br>Date:2015-5-7
 */
package com.asframe.pool.impl
{
	import com.asframe.pool.IPoolableObjectFactory;
	
	import flash.utils.Timer;
	
	/**
	 * 时间管理对象的制作工厂
	 * @author sodaChen
	 * Date:2015-5-7
	 */
	public class TimerFactoryImpl implements IPoolableObjectFactory
	{
		public function makeObject():*
		{
			//获得Timer实例之后，可以具体再设置相关参数
			return new Timer(1000,1);
		}
		
		public function destroyObject(obj:*):void
		{
			Timer(obj).stop();
		}
		
		public function activateObject(obj:*):void
		{
			Timer(obj).reset();
			//设置回默认值
			Timer(obj).repeatCount = 0;
		}
		
		public function passivateObject(obj:*):void
		{
			Timer(obj).stop();
		}
	}
}